﻿<!--#include virtual="/Common/Config.asp" -->
<!--#include virtual="/Common/conn.asp" -->
<!--#include virtual="/2010admin/Check_IsLogin.asp" -->
<!--#include virtual="/Common/Function.asp" -->
<!--#include virtual="/Common/Cls_Upload.asp" -->
<!--#include file="Spot_Pic_Inc.asp" -->
<%
If Request.ServerVariables ("Request_Method")="POST" Then

	'禁止从网站外部提交数据
	Call Deny_OutSiteSubit()

	Set  Aspto = new Cls_Upload
	Aspto.FileType=Upload_FileType	
	Aspto.MaxSize = Max_Upload_Size
	Aspto.SavePath=Upload_SavePath&"News_Pic/"   '图片上传位置 /UploadImages/Pic_Gallery/
	Aspto.Open() 

	If Aspto.Error<>0 Then  '发生错误
		Set Aspto = Nothing 
		AlertBox "发生错误，请检查你上传的文件!","javascript:history.go(-1)"	
	End If 

	For intTemp=1 To Ubound(Aspto.FileItem)
		FormName = Aspto.FileItem(intTemp)
		IF Int(Aspto.Form(FormName&"_Err")) = Int(0) Then
			ImageName = ImageName&Aspto.Form(FormName)&"|"
		Else
			AlertBox "文件上传失败，请检查文件!","javascript:history.back();"
		End If

	Next

	If ImageName<>"" Then
		Pic_Path = Left(ImageName,Len(ImageName)-1)
	Else
		Set Aspto = nothing 
		AlertBox "请提交图片!","javascript:history.go(-1)"
	End If

	
	Pic_Name = Aspto.Form("Pic_Name")

	IsCover  = Aspto.Form("IsCover")
	Info_ID	 = Aspto.Form("Info_ID")

	If IsCover="" Then 
		IsCover ="0"
	End If

	select_number = Aspto.Form("select")

	
	
	Pic_Name = ""
	Pic_Desc = ""
	IsCover  = ""

	For i=0 To CInt(select_number)
		Pic_Name = Pic_Name &Aspto.Form("Pic_Name"&i)&"|"
		IsCover  = IsCover  &Aspto.Form("IsCover"&i)&"|"
	Next

	If Pic_Name<>"" Then
		Pic_Name = Left(Pic_Name,Len(Pic_Name)-1)
	End If

	If IsCover<>"" Then
		IsCover = Left(IsCover,Len(IsCover)-1)
	End If
	

	Set Aspto = nothing 

	Call News_Pic_Add()
Else
	Info_ID = requery("Info_ID")
	Call Check_IsNumeric_Msg(Info_ID,"资讯ID")
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="/2010admin/css/default.css" type="text/css" rel="stylesheet">
<title><%=web_title%></title>
<script language="javascript" src="/2010admin/js/validator.js"></script>
<script language="javascript" src="/js/prototype1.5.0.js"></script>
<script language="JavaScript">
<!--
function setFileFileds(num){	
	for(var i=0,str="";i<num;i++){
		str+="<input name=\"strFile"+i+"\" type=\"file\" id=\"strFile"+i+"\" onkeydown= \"event.returnValue=false; \" dtype=\"Limit\" min=\"2\" max=\"100\" dmsg=\"请上传图片\">&nbsp;&nbsp;&nbsp;&nbsp;图片名称&nbsp;&nbsp;<input type=\"text\" name=\"Pic_Name"+i+"\" size=\"20\" dtype=\"Limit\" min=\"2\" max=\"100\" dmsg=\"图片名称必须在2-100个字符间\">&nbsp;&nbsp;封面<input name=\"IsCover"+i+"\" type=\"radio\" class=\"radio\" value=\"1\" >是&nbsp;<input name=\"IsCover"+i+"\" type=\"radio\" class=\"radio\" value=\"0\"  Checked>否&nbsp;<br>";
	}
	objFiles.innerHTML=str;
}
//-->
</script>

</head>
<body >
<table border="0" width="100%" cellSpacing="0" cellPadding="0">
  <tr>
    <td width="100%" height="5"></td>
  </tr>
  <tr>
    <td width="100%" align="center">
      <table border="0" width="98%" cellSpacing="0" cellPadding="0">
        <tr>
          <td width="*" align="center" valign="top">
            <table border="0" width="100%" cellSpacing="0" cellPadding="0" class="lrbtline">
              <tr>
                <td width="100%" height="25" class="tbtop">管理导航</td>
              </tr>
              <tr>
                <td width="100%" align="center">
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="20">&nbsp;<img src="/2010admin/images/sico.gif" border="0">&nbsp;<span id="userlist"><a href="Info_Pic_Query.asp?Info_ID=<%=Info_ID%>">图片列表</a></span>&nbsp;</span></td>
                    </tr>
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table border="0" width="100%" cellSpacing="0" cellPadding="0">
              <tr>
                <td width="100%" height="5"></td>
              </tr>
            </table>
            <table border="0" width="100%" cellSpacing="0" cellPadding="0" class="lrbtline">
              <tr>
                <td width="100%" height="25" class="tbtop">增加新的图片</td>
              </tr>
              <tr>
                <td width="100%" align="center">
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                  <form action="Info_Pic_Add.asp" method="post" enctype="multipart/form-data" name="form" onSubmit="return Validator.Validate(this, 2)">
                    <tr>
                      <td width="80" height="25">图片数量</td>
                      <td width="*">
					  <select name="select" onChange="setFileFileds(this.value)">
						  <option value="1" selected>1</option>
						  <option value="2">2</option>
						  <option value="3">3</option>
						  <option value="4">4</option>
						  <option value="5">5</option>
						  <option value="6">6</option>
						  <option value="7">7</option>
						  <option value="8">8</option>
						  <option value="9">9</option>
						  <option value="10">10</option>
						</select>
					</td>
                    </tr>
					<tr>
                      <td width="80" height="25">图片文件</td>
					  <td id="objFiles"></td>
                    </tr>
                    
                    <tr>
                      <td height="25"></td>
                      <td>
					  <input type="submit" name="submit" value="提交" class="button">
					  <input type="hidden" name="Info_ID" value="<%=Info_ID%>" >
					  </td>
                    </tr>

                  </form>
                  </table>
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%" height="5"></td>
  </tr>
</table>
<script language="JavaScript">setFileFileds(form.select.value)</script>

</body>
</html>

<%
Call conn_close()
%>

